﻿//Copyright (C) Microsoft Corporation.  All rights reserved.
using System.Collections.Generic;

namespace NorthwindModel.Models
{
    public partial class Category
    {
        // Products is declared as virtual so that we get automatic Deferred loading
        //public virtual List<Product> Products { get; set; }
        
        public void AddProduct(Product p)
        {
            if (Products == null)
            {
                Products = new List<Product>();
            }

            if (!Products.Contains(p))
            {
                Products.Add(p);
            }

            p.Category = this;
        }        
    }
}
